<template>
  <el-container style="height: 100%; border: 1px solid #eee">
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <div class="img">
        <img src="../../assets/images/header.png" alt="header" style="height: 60px;
    width: 15.5em;
    margin-left: -11px;"/>
      </div>

      <el-menu :default-openeds="[1]" :default-active="activeIndex">
        <el-menu-item index="1" @click="active=0">
          <template #title><i class="el-icon-message"></i>学生基本信息</template>
        </el-menu-item>
        <el-menu-item index="2" @click="active=3">
          <template #title><i class="el-icon-menu"></i>学分详情</template>
        </el-menu-item>
        <el-submenu index="3">
          <template #title><i class="el-icon-setting"></i>申请与反馈</template>
          <el-menu-item-group>
            <el-menu-item index="3-1" @click="active=1">申请</el-menu-item>
            <el-menu-item index="3-2" @click="active=2">反馈</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
      </el-menu>
    </el-aside>
    <el-container>
      <el-header style="text-align: right; font-size: 12px">
        <el-dropdown>
          <i class="el-icon-setting" style="margin-right: 15px"></i>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item @click="outLogin">退出</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
        <span style="margin-right: 15px;">{{ dataList.name }}</span>

      </el-header>
      <template v-if="active===0"><el-main>
        <el-row>
          <el-col :span="10" :offset="1">
            <profile/>
          </el-col>
          <el-col :span="11" :offset="2">
            <notice/>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1" class="every-div">
            <action/>
          </el-col>
        </el-row>
      </el-main></template>

      <template v-if="active===1"><course/></template>
      <template v-if="active===2"><feed-back/></template>
      <template v-if="active===3"><student-agree-all-apply/></template>

    </el-container>
  </el-container>



</template>


<script>
import Profile from './childComps/Profile'
import Notice from './childComps/Notice'
import Course from './childComps/ApplyCredit'
import Action from './childComps/Action'
import FeedBack from "./childComps/FeedBack";
import StudentAgreeAllApply from "./childComps/StudentAgreeAllApply";
import Aside from './components/aside'
import {reactive} from "vue";

export default {
  name: 'studentIndex',
  data(){
    return{
      active:0,
      activeIndex:1
    }
  },
  components: {
    Profile,
    Notice,
    Course,
    Action,
    FeedBack,
    StudentAgreeAllApply,
    Aside
  },
  setup(props){
    const dataList = reactive({
      name: '',
    })
    dataList.name =  localStorage.getItem('StudentName')

    function outLogin(){
      window.location.href = 'http://localhost:8080/';
      //退出登录清除所有缓存
      localStorage.clear()
    }


    return {
      dataList,
      outLogin

    }
  }
}
</script>

<style>
.el-header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-main {
  background-color: #fff;
  color: #333;
}

.every-div {
  margin-top: 20px;
}

</style>
